#include <QtGui>
#include "MyView.h"
#include <QBoxLayout>
#include <QGraphicsItem>
#include <QPushButton>
#include <QApplication>
#include <QGraphicsEllipseItem>
#include <QLineEdit>


void cvet2(QGraphicsEllipseItem * pe)
{
    pe->setBrush(QBrush(Qt::blue));
}

int main(int argc, char** argv)
{
    QApplication   app(argc, argv);

    QWidget        wgt;
    QGraphicsScene scene(QRectF(-100, -100, 320, 240));

    //===================================================================================
    MyView*      pView           = new MyView(&scene);
    QPushButton* pcmdZoomIn      = new QPushButton("Увеличить");
    QPushButton* pcmdZoomOut     = new QPushButton("Уменьшить");
    QPushButton* pcmdRotateLeft  = new QPushButton("Вращать вправо");
    QPushButton* pcmdRotateRight = new QPushButton("Вращать влево");
    QPushButton* changecvet = new QPushButton("Изменить цвет фона");
    QLineEdit * line = new QLineEdit;

    QGraphicsEllipseItem * ellipse = new QGraphicsEllipseItem;

    ellipse->setBrush(QBrush(Qt::red));
    ellipse->setPen(QPen(Qt::black));
    ellipse->setRect(QRectF(17,-20,100,100));




    scene.addItem(ellipse);
   //cvet2(ellipse);

    //=====================================================================================
    QObject::connect(pcmdZoomIn, SIGNAL(clicked()),pView, SLOT(slotZoomIn()));
    QObject::connect(pcmdZoomOut, SIGNAL(clicked()), pView,SLOT(slotZoomOut()));
    QObject::connect(pcmdRotateLeft, SIGNAL(clicked()),pView,SLOT(slotRotateLeft()));
    QObject::connect(pcmdRotateRight, SIGNAL(clicked()),pView,SLOT(slotRotateRight()));
    QObject::connect(changecvet, SIGNAL(clicked()),pView,SLOT(cvet()));

    //=====================================================================================
    QVBoxLayout* sloy = new QVBoxLayout;
    sloy->addWidget(pView);
    sloy->addWidget(pcmdZoomIn);
    sloy->addWidget(pcmdZoomOut);
    sloy->addWidget(pcmdRotateLeft);
    sloy->addWidget(pcmdRotateRight);
    sloy->addWidget(changecvet);
    //sloy->addWidget(line);

    wgt.setLayout(sloy);

    wgt.show();

    return app.exec();
}


